# -*- coding: utf-8 -*-
from odoo import models, api, fields, tools
from odoo.exceptions import UserError
import re


class conservancy_facility_item(models.Model):

    _name = "proman.conservancy_facility_item"
    _description = "水利设施概况清单"
    _table = "proman_conservancy_facility_item"
    _order = "sequence"

    sequence = fields.Integer(string="排序",translate = 0)
    main_id = fields.Many2one(string="主单据号",comodel_name = 'proman.conservancy_facility',ondelete = 'cascade',translate = 0)
    company_id = fields.Many2one(string="所属公司",comodel_name = 'res.company',default = lambda self:self.env.company,required = 1,translate = 0)
    name = fields.Char(string="清单名称",help = '请输入清单名称',translate = 0)
    line_project_stage_id = fields.Many2one(string="项目阶段",comodel_name = 'proman.stage_category',related = 'main_id.project_stage_id',store = 1,translate = 0)
    line_year = fields.Date(string="年度",related = 'main_id.year',store = 1,translate = 0)
    line_manage_department_id = fields.Many2one(string="管理机构",comodel_name = 'hr.department',related = 'main_id.manage_department_id',store = 1,translate = 0)
    line_project_id = fields.Many2one(string="项目名称",comodel_name = 'proman.project_base',related = 'main_id.project_id',store = 1,translate = 0)
    line_region_id = fields.Many2one(string="省市县区",comodel_name = 'setcent.region',related = 'main_id.region_id',store = 1,translate = 0)
    township_village_id = fields.Many2one(string="所属行政村",comodel_name = 'proman.township_village',translate = 0)
    facility_name = fields.Char(string="工程设施名称",translate = 0)
    address = fields.Char(string="工程设施地址",translate = 0)
    facility_category_id = fields.Many2one(string="工程设施类型",comodel_name = 'proman.facility_category',translate = 0)
    quantity = fields.Float(string="数量",translate = 0)
    holding_capacity = fields.Float(string="蓄引提水能力(万立方米)",translate = 0)
    coefficient_storage = fields.Float(string="复蓄系数",translate = 0)
    exploit_capacity = fields.Float(string="开发利用量(万立方米)",translate = 0)
    supply_capacity = fields.Float(string="可供水量(万立方米)",translate = 0)
    cotrol_area = fields.Float(string="控制面积(亩）",translate = 0)
    memo = fields.Text(string="说明",translate = 0)
